package mysql

import "gorm.io/gorm"

type Shops struct {
	gorm.Model
	ShopName      string  `gorm:"type:varchar(50);not null;comment '商品名字'" json:"shopName"`
	ShopDesc      string  `gorm:"type:varchar(255);not null;comment '商品描述'" json:"shopDesc"`
	ShopPrice     float64 `gorm:"type:decimal(10,2);not null;comment '商品价格'" json:"shopPrice"`
	ShopInventory int     `gorm:"type:int(11);not null;comment '商品库存'" json:"shopInventory"`
	ShopStatus    int     `gorm:"type:int(11);not null;comment '商品状态 0=下架 1=上架 2=售罄 3=未审核'" json:"shopStatus"`
}

type ShopList struct {
	Id            int
	ShopImage     string
	ShopName      string
	ShopDesc      string
	ShopPrice     float64
	ShopInventory int
	ShopStatus    int
}

func (s *Shops) ShopExamine() error {
	err = DB.Updates(&s).Error
	return err
}
